import request from '@/utils/request'

export function getDeptList(data) {
    return request({
        url: '/sysDept/getWithTree.do',
        method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'      //改这里就好了
        },
        data,
    })
}

export function getAllDept() {
    return request({
        url: '/sysDept/getAllDept.do',
        method: 'post',
    })
}

export function getDeptListByUser(data) {
    return request({
        url: '/sysDept/getWithTreeByUser.do',
        method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'      //改这里就好了
        },
        data,
    })
}

export function getUserByDeptId(data) {
    return request({
        url: '/sysDept/getUserByDeptId.do?id=' + data,
        method: 'post'
    })
}

export function doDeptEdit(data) {
    return request({
        url: '/sysDept/update.do',
        method: 'post',
        // headers: {
        //     'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'      //改这里就好了
        // },
        data,
    })
}

export function doDeptDelete(data) {
    return request({
        url: '/sysDept/deleteDept.do?id=' + data,
        method: 'post'
    })
}

export function getDept(data) {
    return request({
        url: '/sysDept/getDept.do?id=' + data,
        method: 'post'
    })
}
